<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<!--
 This default page is designed to support several defaults:
 1. Error pages generated by Spring Boot's error configuration receive
      $timestamp, $status, $error, $message as variables - see
      org.springframework.boot.actuate.web.BasicErrorController
 2. By default, error pages setup by SimpleMappingExceptionResolver receive
      $exception
 3. We have configured our SimpleMappingExceptionResolver to setup $ex
      instead, just to show it can be done.
 -->
<body>
<h1>Default metatron Error Page</h1>

<!--  As we are using Thymeleaf, you might consider using
      ${#httpServletRequest.requestURL}. But that returns the path
      to this error page.  Hence we explicitly add the url to the
      Model in some of the example code. -->
<p th:if="${url}">
    <b>Page:</b> <span th:text="${url}">Page URL</span>
</p>

<p th:if="${timestamp}" id='created'>
    <b>Occurred:</b> <span th:text="${timestamp}">Timestamp</span>
</p>

<p th:if="${status}">
    <b>Response Status:</b> <span th:text="${status}">status-code</span> <span
        th:if="${error}" th:text="'('+${error}+')'">error ...</span>
</p>

<!--/* ${ex} is set by ourSimpleMappingExceptionResolver,
       ${exception} or ${message} are set internally by Spring Boot. */-->
<div
        th:if="${ex} or ${exception} or (${message} and ${message.length() != 0})">
    <b>Cause:</b> <span th:if="${ex}" th:text="${ex}">exception ...</span>
    <span th:if="${exception}" th:text="${exception}">exception ...</span>
    <span th:if="${message} and ${message.length() != 0}"
          th:text="${message}">message ...</span>
    <blockquote>
        <i>Note: You would never generate a page that displays a Java
            exception to an end-user in a real application</i>
    </blockquote>
</div>

<p
        th:unless="${ex} or ${exception} or (${message} and ${message.length() != 0})">
    Cause unknown (no exception details available)</p>

<p>
    You are seeing this error page due to Spring Boot (which returns a
    view called "error" in response to uncaught exceptions. Since we are
    using Thymeleaf this corresponds to the template
    <code>error.html</code>
    )
</p>

</body>
</html>